﻿<Window x:Class="BotvaBot.RichUI.SimpleCommandsForm"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="SimpleCommandsForm" Height="300" Width="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>

        <Grid.Resources>
            <XmlDataProvider x:Key="countriesXml" 
                Source="Commands.xml" 
                XPath="CommandGroups/CommandGroup" />

            <HierarchicalDataTemplate DataType="CommandGroup" ItemsSource="{Binding}" >
                <TextBlock Width="150" Text="{Binding XPath=@Name}" />
            </HierarchicalDataTemplate>

            <HierarchicalDataTemplate DataType="CommandSubGroup" ItemsSource="{Binding}" >
                <TextBlock Width="140" Text="{Binding XPath=@Name}" />
            </HierarchicalDataTemplate>

            <DataTemplate DataType="Command">
                <Label Width="130">
                    <Hyperlink NavigateUri="{Binding XPath=@Command}" RequestNavigate="ExecuteCommandQuery" >
                        <TextBlock Text="{Binding XPath=@Name}" />
                    </Hyperlink>
                </Label>
            </DataTemplate>
        </Grid.Resources>

        <GridSplitter Grid.Row="0" Grid.Column="1" Grid.RowSpan="1" Width="3" VerticalAlignment="Stretch" HorizontalAlignment="Center" ShowsPreview="False">
        </GridSplitter>

        <TreeView Name="tvCommands" Grid.Row="0" Grid.Column="0" Margin="5,5,5,5" DataContext="{StaticResource countriesXml}" ItemsSource="{Binding}">
            <TreeView.Resources>
                <ResourceDictionary Source="GroupedTreeViewItemStyle.xaml" />
            </TreeView.Resources>
        </TreeView>
        
        <Grid Grid.Row="0" Grid.Column="3">
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            
            <TextBox Name="txtUrl" Grid.Column="0" Grid.Row="0" Text="{Binding Path=Url, Mode=TwoWay}"></TextBox>
            <TextBox Name="txtMethod" Grid.Column="0" Grid.Row="1" Text="{Binding Path=Method, Mode=TwoWay}"></TextBox>
            <TextBox Name="txtGET" Grid.Column="0" Grid.Row="2" Text="{Binding Path=GET, Mode=TwoWay}"></TextBox>
            <TextBox Name="txtPOST" Grid.Column="0" Grid.Row="3" Text="{Binding Path=POST, Mode=TwoWay}"></TextBox>
            <TextBox Name="txtHeaders" Grid.Column="0" Grid.Row="4" Text="{Binding Path=Headers, Mode=TwoWay}"></TextBox>
            <TextBox Name="txtInputCookies" Grid.Column="0" Grid.Row="5" Text="{Binding Path=InputCookies, Mode=TwoWay}"></TextBox>
            <TextBox Name="txtOutputCookies" Grid.Column="0" Grid.Row="6" Text="{Binding Path=OutputCookies, Mode=TwoWay}"></TextBox>
            <TextBox Name="txtHtml" Grid.Column="0" Grid.Row="7" Text="{Binding Path=Html, Mode=TwoWay}"></TextBox>
        </Grid>
        
    </Grid>
</Window>
